# Makefile for Irrlicht Examples
# It's usually sufficient to change just the target name and source file list
# and be sure that CXX is set to a valid compiler
Target = massrts
Objects = main.o Camera.o ILogicNode.o Input.o LogicManager.o Fighter.o Player.o

# general compiler settings
CPPFLAGS = -I./include -I/usr/X11R6/include
#CXXFLAGS = -O3 -ffast-math
CXXFLAGS = -g

#default target is Linux
all: all_linux

ifeq ($(HOSTTYPE), x86_64)
LIBSELECT=64
endif

# target specific settings
all_linux: LDFLAGS = -L/usr/X11R6/lib$(LIBSELECT) -L./lib/ -lIrrlicht -lGL -lGLU -lXxf86vm -lXext -lX11
all_linux clean_linux: SYSTEM=Linux
all_win32: LDFLAGS = -L../../lib/Win32-gcc -lIrrlicht -lopengl32 -lglu32 -lm
all_win32 clean_win32: SYSTEM=Win32-gcc
all_win32 clean_win32: SUF=.exe
# name of the binary - only valid for targets which set SYSTEM
DESTPATH = ./bin/$(Target)$(SUF)

all_linux all_win32: $(Objects)
	$(warning Building...)
	$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(Objects) -o $(DESTPATH) $(LDFLAGS)

main.o: main.cpp
	$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c main.cpp

Camera.o: Camera.cpp Camera.h
	$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c Camera.cpp

ILogicNode.o: ILogicNode.cpp ILogicNode.h
	$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c ILogicNode.cpp

Input.o: Input.cpp Input.h
	$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c Input.cpp

LogicManager.o: LogicManager.cpp LogicManager.h
	$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c LogicManager.cpp

Fighter.o: Fighter.cpp Fighter.h
	$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c Fighter.cpp

Player.o: Player.cpp Player.h
	$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c Player.cpp

clean: clean_linux clean_win32
	$(warning Cleaning...)

clean_linux clean_win32:
	@$(RM) $(DESTPATH) $(Objects)

.PHONY: all all_win32 clean clean_linux clean_win32
